\hypertarget{sub__menu_8c}{
\section{front\_\-panel/sub\_\-menu.c File Reference}
\label{sub__menu_8c}\index{front\_\-panel/sub\_\-menu.c@{front\_\-panel/sub\_\-menu.c}}
}
Antenna sub menu functions.  


{\tt \#include $<$stdio.h$>$}\par
{\tt \#include $<$stdlib.h$>$}\par
{\tt \#include $<$avr/io.h$>$}\par
{\tt \#include $<$string.h$>$}\par
{\tt \#include \char`\"{}sub\_\-menu.h\char`\"{}}\par
{\tt \#include \char`\"{}antenna\_\-ctrl.h\char`\"{}}\par
{\tt \#include \char`\"{}main.h\char`\"{}}\par
{\tt \#include \char`\"{}eeprom.h\char`\"{}}\par
{\tt \#include \char`\"{}band\_\-ctrl.h\char`\"{}}\par
{\tt \#include \char`\"{}../global.h\char`\"{}}\par
{\tt \#include \char`\"{}../internal\_\-comm.h\char`\"{}}\par
{\tt \#include \char`\"{}../wmv\_\-bus/bus.h\char`\"{}}\par
{\tt \#include \char`\"{}../wmv\_\-bus/bus\_\-rx\_\-queue.h\char`\"{}}\par
{\tt \#include \char`\"{}../wmv\_\-bus/bus\_\-tx\_\-queue.h\char`\"{}}\par
{\tt \#include \char`\"{}../wmv\_\-bus/bus\_\-commands.h\char`\"{}}\par
\subsection*{Functions}
\begin{CompactItemize}
\item 
void \hyperlink{sub__menu_8c_1070bc0cf80e49b60d21255cb9e656bd}{sub\_\-menu\_\-load} (unsigned char band\_\-index)
\begin{CompactList}\small\item\em Load a set of sub menu from the EEPROM for a specific band. \item\end{CompactList}\item 
unsigned char $\ast$ \hyperlink{sub__menu_8c_c2b58f2d273fadec85e84063104eabaf}{sub\_\-menu\_\-get\_\-text} (unsigned char ant\_\-index, unsigned char pos)
\begin{CompactList}\small\item\em Get the text for the sub menu. \item\end{CompactList}\item 
unsigned char \hyperlink{sub__menu_8c_3172f5b466813a529713bc67394a4193}{sub\_\-menu\_\-get\_\-current\_\-pos} (unsigned char ant\_\-index)
\begin{CompactList}\small\item\em Get the current position of the sub menu cursor. \item\end{CompactList}\item 
void \hyperlink{sub__menu_8c_59d5dbe1bff938b9fd4cdb47ef22fe59}{sub\_\-menu\_\-set\_\-current\_\-pos} (unsigned char ant\_\-index, unsigned char new\_\-pos)
\begin{CompactList}\small\item\em Set the current sub menu option. \item\end{CompactList}\item 
unsigned char \hyperlink{sub__menu_8c_c17081a0f178032151b20db872b6b2fa}{sub\_\-menu\_\-get\_\-count} (void)
\begin{CompactList}\small\item\em Get the number of antennas which has got a sub menu configured. \item\end{CompactList}\item 
unsigned char \hyperlink{sub__menu_8c_fe72c5037c9593de0cac6a2f03240cc5}{sub\_\-menu\_\-get\_\-type} (unsigned char ant\_\-index)
\begin{CompactList}\small\item\em Get the sub menu type of an antenna. \item\end{CompactList}\item 
void \hyperlink{sub__menu_8c_234aa975183ff8d2582b247dd7c89b04}{sub\_\-menu\_\-pos\_\-down} (unsigned char ant\_\-index)
\begin{CompactList}\small\item\em This function should be called when we wish to decrease the selected sub menu option. \item\end{CompactList}\item 
void \hyperlink{sub__menu_8c_693faabfba9ef01f271987eb38763c38}{sub\_\-menu\_\-pos\_\-up} (unsigned char ant\_\-index)
\begin{CompactList}\small\item\em This function should be called when we wish to increase the selected sub menu option. \item\end{CompactList}\item 
void \hyperlink{sub__menu_8c_8de7774ddfb80f8a09829cf327ab50e3}{sub\_\-menu\_\-send\_\-data\_\-to\_\-bus} (unsigned char ant\_\-index, unsigned char pos)
\begin{CompactList}\small\item\em Send the output string for the sub menu position to the bus. \item\end{CompactList}\item 
\hypertarget{sub__menu_8c_20f72c68f7c5e4bcc0fb9dcbcccfff75}{
void \hyperlink{sub__menu_8c_20f72c68f7c5e4bcc0fb9dcbcccfff75}{sub\_\-menu\_\-deactivate\_\-all} (void)}
\label{sub__menu_8c_20f72c68f7c5e4bcc0fb9dcbcccfff75}

\begin{CompactList}\small\item\em Will deactivate all currently selected outputs which has been sent out on the bus. \item\end{CompactList}\item 
\hypertarget{sub__menu_8c_d3b31cd17b571b379eb17c2c17c736e2}{
void \hyperlink{sub__menu_8c_d3b31cd17b571b379eb17c2c17c736e2}{sub\_\-menu\_\-activate\_\-all} (void)}
\label{sub__menu_8c_d3b31cd17b571b379eb17c2c17c736e2}

\begin{CompactList}\small\item\em This function will go through the sub menus and if there is one configured it will activae its default option which is index 0. \item\end{CompactList}\end{CompactItemize}
\subsection*{Variables}
\begin{CompactItemize}
\item 
\hypertarget{sub__menu_8c_7bb78d8f5fb30e646eed0a007d76c654}{
\hyperlink{structstruct__sub__menu__array}{struct\_\-sub\_\-menu\_\-array} \hyperlink{sub__menu_8c_7bb78d8f5fb30e646eed0a007d76c654}{current\_\-sub\_\-menu\_\-array} \mbox{[}4\mbox{]}}
\label{sub__menu_8c_7bb78d8f5fb30e646eed0a007d76c654}

\begin{CompactList}\small\item\em Current sub menu array. \item\end{CompactList}\item 
\hypertarget{sub__menu_8c_3e64ac1dd1512a5bf87d7f4f212b4a7b}{
unsigned char \hyperlink{sub__menu_8c_3e64ac1dd1512a5bf87d7f4f212b4a7b}{curr\_\-option\_\-selected} \mbox{[}4\mbox{]} = \{0,0,0,0\}}
\label{sub__menu_8c_3e64ac1dd1512a5bf87d7f4f212b4a7b}

\begin{CompactList}\small\item\em Which option is currently selected of the sub menu options. \item\end{CompactList}\item 
\hypertarget{sub__menu_8c_f85a5f56eea7c72a924acc04cdf01f98}{
unsigned char \hyperlink{sub__menu_8c_f85a5f56eea7c72a924acc04cdf01f98}{current\_\-activated\_\-sub\_\-outputs} \mbox{[}4\mbox{]}\mbox{[}SUB\_\-MENU\_\-ARRAY\_\-STR\_\-SIZE\mbox{]}}
\label{sub__menu_8c_f85a5f56eea7c72a924acc04cdf01f98}

\begin{CompactList}\small\item\em Array which we store the current devices which we have activated antenna outputs on. \item\end{CompactList}\item 
\hypertarget{sub__menu_8c_2194ee56c3a6218206e1b537812ccdd3}{
unsigned char \hyperlink{sub__menu_8c_2194ee56c3a6218206e1b537812ccdd3}{current\_\-activated\_\-sub\_\-outputs\_\-length} \mbox{[}4\mbox{]} = \{0,0,0,0\}}
\label{sub__menu_8c_2194ee56c3a6218206e1b537812ccdd3}

\begin{CompactList}\small\item\em How many devices we have activated antenna outputs on. \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
Antenna sub menu functions. 

Antenna sub menu functions \begin{Desc}
\item[Author:]Mikael Larsmark, SM2WMV \end{Desc}
\begin{Desc}
\item[Date:]2010-04-28 

\begin{Code}\begin{verbatim} #include "front_panel/sub_menu.c" 
\end{verbatim}
\end{Code}

 \end{Desc}


Definition in file \hyperlink{sub__menu_8c-source}{sub\_\-menu.c}.

\subsection{Function Documentation}
\hypertarget{sub__menu_8c_c17081a0f178032151b20db872b6b2fa}{
\index{sub\_\-menu.c@{sub\_\-menu.c}!sub\_\-menu\_\-get\_\-count@{sub\_\-menu\_\-get\_\-count}}
\index{sub\_\-menu\_\-get\_\-count@{sub\_\-menu\_\-get\_\-count}!sub_menu.c@{sub\_\-menu.c}}
\subsubsection[{sub\_\-menu\_\-get\_\-count}]{\setlength{\rightskip}{0pt plus 5cm}unsigned char sub\_\-menu\_\-get\_\-count (void)}}
\label{sub__menu_8c_c17081a0f178032151b20db872b6b2fa}


Get the number of antennas which has got a sub menu configured. 

\begin{Desc}
\item[Returns:]The number of antennas which has got sub menus, (0-4) \end{Desc}


Definition at line 101 of file sub\_\-menu.c.

References antenna\_\-ctrl\_\-get\_\-sub\_\-menu\_\-type(), and SUBMENU\_\-NONE.

Referenced by event\_\-sub\_\-button\_\-pressed().\hypertarget{sub__menu_8c_3172f5b466813a529713bc67394a4193}{
\index{sub\_\-menu.c@{sub\_\-menu.c}!sub\_\-menu\_\-get\_\-current\_\-pos@{sub\_\-menu\_\-get\_\-current\_\-pos}}
\index{sub\_\-menu\_\-get\_\-current\_\-pos@{sub\_\-menu\_\-get\_\-current\_\-pos}!sub_menu.c@{sub\_\-menu.c}}
\subsubsection[{sub\_\-menu\_\-get\_\-current\_\-pos}]{\setlength{\rightskip}{0pt plus 5cm}unsigned char sub\_\-menu\_\-get\_\-current\_\-pos (unsigned char {\em ant\_\-index})}}
\label{sub__menu_8c_3172f5b466813a529713bc67394a4193}


Get the current position of the sub menu cursor. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ant\_\-index}]The antenna index, (0-3) \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]The cursor position of the sub menu \end{Desc}


Definition at line 88 of file sub\_\-menu.c.

References curr\_\-option\_\-selected.

Referenced by display\_\-rotator\_\-directions(), display\_\-show\_\-sub\_\-menu(), main(), sub\_\-menu\_\-pos\_\-down(), and sub\_\-menu\_\-pos\_\-up().\hypertarget{sub__menu_8c_c2b58f2d273fadec85e84063104eabaf}{
\index{sub\_\-menu.c@{sub\_\-menu.c}!sub\_\-menu\_\-get\_\-text@{sub\_\-menu\_\-get\_\-text}}
\index{sub\_\-menu\_\-get\_\-text@{sub\_\-menu\_\-get\_\-text}!sub_menu.c@{sub\_\-menu.c}}
\subsubsection[{sub\_\-menu\_\-get\_\-text}]{\setlength{\rightskip}{0pt plus 5cm}unsigned char$\ast$ sub\_\-menu\_\-get\_\-text (unsigned char {\em ant\_\-index}, \/  unsigned char {\em pos})}}
\label{sub__menu_8c_c2b58f2d273fadec85e84063104eabaf}


Get the text for the sub menu. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ant\_\-index}]The antenna index we wish to get the antenna text for \item[{\em pos}]Which sub menu position to show \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]Returns the text of the sub menu antenna index \end{Desc}


Definition at line 77 of file sub\_\-menu.c.

References antenna\_\-ctrl\_\-get\_\-sub\_\-menu\_\-type(), and SUBMENU\_\-VERT\_\-ARRAY.

Referenced by display\_\-rotator\_\-directions(), and display\_\-show\_\-sub\_\-menu().\hypertarget{sub__menu_8c_fe72c5037c9593de0cac6a2f03240cc5}{
\index{sub\_\-menu.c@{sub\_\-menu.c}!sub\_\-menu\_\-get\_\-type@{sub\_\-menu\_\-get\_\-type}}
\index{sub\_\-menu\_\-get\_\-type@{sub\_\-menu\_\-get\_\-type}!sub_menu.c@{sub\_\-menu.c}}
\subsubsection[{sub\_\-menu\_\-get\_\-type}]{\setlength{\rightskip}{0pt plus 5cm}unsigned char sub\_\-menu\_\-get\_\-type (unsigned char {\em ant\_\-index})}}
\label{sub__menu_8c_fe72c5037c9593de0cac6a2f03240cc5}


Get the sub menu type of an antenna. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ant\_\-index}]The antenna we wish to get the sub menu type of, (0-3) \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]The sub meny type of the antenna \end{Desc}


Definition at line 114 of file sub\_\-menu.c.

References antenna\_\-ctrl\_\-get\_\-sub\_\-menu\_\-type().

Referenced by event\_\-pulse\_\-sensor\_\-down(), event\_\-pulse\_\-sensor\_\-up(), sub\_\-menu\_\-pos\_\-down(), and sub\_\-menu\_\-pos\_\-up().\hypertarget{sub__menu_8c_1070bc0cf80e49b60d21255cb9e656bd}{
\index{sub\_\-menu.c@{sub\_\-menu.c}!sub\_\-menu\_\-load@{sub\_\-menu\_\-load}}
\index{sub\_\-menu\_\-load@{sub\_\-menu\_\-load}!sub_menu.c@{sub\_\-menu.c}}
\subsubsection[{sub\_\-menu\_\-load}]{\setlength{\rightskip}{0pt plus 5cm}void sub\_\-menu\_\-load (unsigned char {\em band\_\-index})}}
\label{sub__menu_8c_1070bc0cf80e49b60d21255cb9e656bd}


Load a set of sub menu from the EEPROM for a specific band. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em band\_\-index}]Which we band \end{description}
\end{Desc}


Definition at line 60 of file sub\_\-menu.c.

References antenna\_\-ctrl\_\-get\_\-sub\_\-menu\_\-type(), curr\_\-option\_\-selected, eeprom\_\-get\_\-ant\_\-sub\_\-menu\_\-array\_\-structure(), and SUBMENU\_\-VERT\_\-ARRAY.

Referenced by band\_\-ctrl\_\-load\_\-band().\hypertarget{sub__menu_8c_234aa975183ff8d2582b247dd7c89b04}{
\index{sub\_\-menu.c@{sub\_\-menu.c}!sub\_\-menu\_\-pos\_\-down@{sub\_\-menu\_\-pos\_\-down}}
\index{sub\_\-menu\_\-pos\_\-down@{sub\_\-menu\_\-pos\_\-down}!sub_menu.c@{sub\_\-menu.c}}
\subsubsection[{sub\_\-menu\_\-pos\_\-down}]{\setlength{\rightskip}{0pt plus 5cm}void sub\_\-menu\_\-pos\_\-down (unsigned char {\em ant\_\-index})}}
\label{sub__menu_8c_234aa975183ff8d2582b247dd7c89b04}


This function should be called when we wish to decrease the selected sub menu option. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ant\_\-index}]Which antenna we wish to decrease the sub menu position of \end{description}
\end{Desc}


Definition at line 120 of file sub\_\-menu.c.

References sub\_\-menu\_\-get\_\-current\_\-pos(), sub\_\-menu\_\-get\_\-type(), sub\_\-menu\_\-set\_\-current\_\-pos(), and SUBMENU\_\-VERT\_\-ARRAY.

Referenced by event\_\-pulse\_\-sensor\_\-down().\hypertarget{sub__menu_8c_693faabfba9ef01f271987eb38763c38}{
\index{sub\_\-menu.c@{sub\_\-menu.c}!sub\_\-menu\_\-pos\_\-up@{sub\_\-menu\_\-pos\_\-up}}
\index{sub\_\-menu\_\-pos\_\-up@{sub\_\-menu\_\-pos\_\-up}!sub_menu.c@{sub\_\-menu.c}}
\subsubsection[{sub\_\-menu\_\-pos\_\-up}]{\setlength{\rightskip}{0pt plus 5cm}void sub\_\-menu\_\-pos\_\-up (unsigned char {\em ant\_\-index})}}
\label{sub__menu_8c_693faabfba9ef01f271987eb38763c38}


This function should be called when we wish to increase the selected sub menu option. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ant\_\-index}]Which antenna we wish to increase the sub menu position of \end{description}
\end{Desc}


Definition at line 131 of file sub\_\-menu.c.

References sub\_\-menu\_\-get\_\-current\_\-pos(), sub\_\-menu\_\-get\_\-type(), sub\_\-menu\_\-set\_\-current\_\-pos(), and SUBMENU\_\-VERT\_\-ARRAY.

Referenced by event\_\-pulse\_\-sensor\_\-up().\hypertarget{sub__menu_8c_8de7774ddfb80f8a09829cf327ab50e3}{
\index{sub\_\-menu.c@{sub\_\-menu.c}!sub\_\-menu\_\-send\_\-data\_\-to\_\-bus@{sub\_\-menu\_\-send\_\-data\_\-to\_\-bus}}
\index{sub\_\-menu\_\-send\_\-data\_\-to\_\-bus@{sub\_\-menu\_\-send\_\-data\_\-to\_\-bus}!sub_menu.c@{sub\_\-menu.c}}
\subsubsection[{sub\_\-menu\_\-send\_\-data\_\-to\_\-bus}]{\setlength{\rightskip}{0pt plus 5cm}void sub\_\-menu\_\-send\_\-data\_\-to\_\-bus (unsigned char {\em ant\_\-index}, \/  unsigned char {\em pos})}}
\label{sub__menu_8c_8de7774ddfb80f8a09829cf327ab50e3}


Send the output string for the sub menu position to the bus. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ant\_\-index}]The index of the antenna you wish to send the string of \item[{\em pos}]The sub menu position we wish to send the output str of \end{description}
\end{Desc}


Definition at line 144 of file sub\_\-menu.c.

References antenna\_\-ctrl\_\-deactivate\_\-outputs(), bus\_\-add\_\-tx\_\-message(), BUS\_\-CMD\_\-DRIVER\_\-ACTIVATE\_\-SUBMENU\_\-ANT1\_\-OUTPUT, BUS\_\-CMD\_\-DRIVER\_\-ACTIVATE\_\-SUBMENU\_\-ANT2\_\-OUTPUT, BUS\_\-CMD\_\-DRIVER\_\-ACTIVATE\_\-SUBMENU\_\-ANT3\_\-OUTPUT, BUS\_\-CMD\_\-DRIVER\_\-ACTIVATE\_\-SUBMENU\_\-ANT4\_\-OUTPUT, BUS\_\-CMD\_\-DRIVER\_\-DEACTIVATE\_\-ALL\_\-SUBMENU\_\-ANT1\_\-OUTPUTS, BUS\_\-CMD\_\-DRIVER\_\-DEACTIVATE\_\-ALL\_\-SUBMENU\_\-ANT2\_\-OUTPUTS, BUS\_\-CMD\_\-DRIVER\_\-DEACTIVATE\_\-ALL\_\-SUBMENU\_\-ANT3\_\-OUTPUTS, BUS\_\-CMD\_\-DRIVER\_\-DEACTIVATE\_\-ALL\_\-SUBMENU\_\-ANT4\_\-OUTPUTS, BUS\_\-CMD\_\-DRIVER\_\-DEACTIVATE\_\-SUBMENU\_\-ANT1\_\-OUTPUT, BUS\_\-CMD\_\-DRIVER\_\-DEACTIVATE\_\-SUBMENU\_\-ANT2\_\-OUTPUT, BUS\_\-CMD\_\-DRIVER\_\-DEACTIVATE\_\-SUBMENU\_\-ANT3\_\-OUTPUT, BUS\_\-CMD\_\-DRIVER\_\-DEACTIVATE\_\-SUBMENU\_\-ANT4\_\-OUTPUT, bus\_\-get\_\-address(), BUS\_\-MESSAGE\_\-FLAGS\_\-NEED\_\-ACK, current\_\-activated\_\-sub\_\-outputs, current\_\-activated\_\-sub\_\-outputs\_\-length, internal\_\-comm\_\-add\_\-tx\_\-message(), OUTPUT\_\-ADDR\_\-DELIMITER, struct\_\-sub\_\-menu\_\-array::output\_\-str\_\-dir, and struct\_\-sub\_\-menu\_\-array::output\_\-str\_\-dir\_\-length.

Referenced by main(), and sub\_\-menu\_\-activate\_\-all().\hypertarget{sub__menu_8c_59d5dbe1bff938b9fd4cdb47ef22fe59}{
\index{sub\_\-menu.c@{sub\_\-menu.c}!sub\_\-menu\_\-set\_\-current\_\-pos@{sub\_\-menu\_\-set\_\-current\_\-pos}}
\index{sub\_\-menu\_\-set\_\-current\_\-pos@{sub\_\-menu\_\-set\_\-current\_\-pos}!sub_menu.c@{sub\_\-menu.c}}
\subsubsection[{sub\_\-menu\_\-set\_\-current\_\-pos}]{\setlength{\rightskip}{0pt plus 5cm}void sub\_\-menu\_\-set\_\-current\_\-pos (unsigned char {\em ant\_\-index}, \/  unsigned char {\em new\_\-pos})}}
\label{sub__menu_8c_59d5dbe1bff938b9fd4cdb47ef22fe59}


Set the current sub menu option. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ant\_\-index}]The antenna index (0-3) \item[{\em new\_\-pos}]The position we wish to chose \end{description}
\end{Desc}


Definition at line 95 of file sub\_\-menu.c.

References curr\_\-option\_\-selected.

Referenced by sub\_\-menu\_\-pos\_\-down(), and sub\_\-menu\_\-pos\_\-up().